﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Selector.aspx.cs" Inherits="TemplateLibraryConnector.Selector" DynamicMasterPageFile="~masterurl/default.master" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Register TagPrefix="tlc" Namespace="TemplateLibraryConnector.ServerControls" Assembly="$SharePoint.Project.AssemblyFullName$" %>


<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <SharePoint:CssRegistration Name="/_layouts/TemplateHub/Styles/TemplateHub.css" After="CoreV4.css" runat="server"  />
    <script src="/_layouts/TemplateHub/Scripts/jquery-1.7.1.js" type="text/javascript"></script>
    <script src="/_layouts/TemplateHub/Scripts/TemplateLibraryConnector.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    <asp:Literal ID="PageTitleLiteral" runat="server" Text="<%$Resources:TemplateLibraryConnector,UI_page_title%>"></asp:Literal>
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea"
    runat="server">
    Select template page
</asp:Content>
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <div id="Container">

        <div id="LeftNav">
            <div id="Filters">
                <div id="FilterTable">
                    <div class="MenuHeader"><asp:Literal ID="Literal1" runat="server" Text="<%$Resources:TemplateLibraryConnector,UI_SelectFrom%>" /></div>
                    <div class="MenuItem"><asp:LinkButton ID="MenuAllTemplates" runat="server" Text="<%$Resources:TemplateLibraryConnector,UI_AllTemplates%>" OnClick="AllTemplates_OnClick" /></div>
                    <div class="MenuItem"><asp:LinkButton ID="MenuLastUsed" runat="server" Text="<%$Resources:TemplateLibraryConnector,UI_LastUsed%>" OnClick="LastUsed_OnClick" /></div>
                    <div class="MenuItem"><asp:LinkButton ID="MenuFavorites" runat="server" Text="<%$Resources:TemplateLibraryConnector,UI_Favorites%>" OnClick="Favorites_OnClick" /></div>
                    <%--<div class="MenuItem"><asp:Literal ID="RecomendedLiteral" runat="server" Text="<%$Resources:TemplateLibraryConnector,UI_Recomended%>" /></div>--%>
                </div>
            </div>
        </div>
        <div id="PreviewZone">
            <div id="SearchBox">
                    <div>
                        <asp:TextBox runat="server" ID="txtSearch" CssClass="SearchInputBox"></asp:TextBox>
                        <asp:ImageButton runat="server" CausesValidation="False" ID="btnSearch" 
                        CssClass="SearchBtn" ImageUrl="~/_layouts/images/ppl_search_normal.png" OnClick="SearchButtonOnClick"/>
                     </div>
            </div>
            <div id="Preview">
                <asp:UpdatePanel runat="server" ID="PreviewPanel" UpdateMode="Always">
                    <ContentTemplate>
                        <asp:Label ID="TemplateTitle" runat="server" CssClass="PreviewTemplateTitle" />
                        <div id="notificationArea" class="s4-noti">
                            <%-- Notifications will appear in this div element. --%> 
                            </div>
                        <div class="PreviewImageContainer">
                            <asp:Literal ID="PreviewImageText" runat="server" Text="<%$Resources:TemplateLibraryConnector,UI_PreviewImageText%>" />
                            <%-- ReSharper disable Html.PathError --%>
                            <asp:Image ID="PreviewImage" runat="server" ImageUrl="/_Layouts/TemplateHub/ThumbNail.ashx" Visible="false" />
                            <%-- ReSharper restore Html.PathError --%>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>
            <div id="ButtonContainer">
                <asp:UpdatePanel runat="server" ID="ButtonPanel" UpdateMode="Always">
                    <ContentTemplate>
                    <asp:Button UseSubmitBehavior="false" CausesValidation="true" runat="server" class="createButton"
                        Text="OK" ID="BtnCreate" AccessKey="<%$Resources:wss,okbutton_accesskey%>"
                        Enabled="true" OnClick="CreateButtonClick" />
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    <asp:Button UseSubmitBehavior="false" CausesValidation="true" runat="server" class="cancelButton" OnClientClick="SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.Cancel, 0);"
                        Text="<%$Resources:TemplateLibraryConnector,UI_BtnCancel%>" ID="BtnCancel" AccessKey="<%$Resources:wss,cancelbutton_accesskey%>"
                        Enabled="true" />   
            </div>
        </div>
        <div id="MainZone">
           
            <div id="ContentZone">
                <div id="TopBar">
                    <div>
                        <table class="ms-menutoolbar menuToolBar">
                            <tr>
                                <td class="ms-toolbar" nowrap="nowrap">
                                    <table border="0" cellpadding="0" cellspacing="0" style='margin-right: 4px'>
                                        <tr>
                                            <td nowrap="nowrap" class="ms-listheaderlabel">
                                                <SharePoint:EncodedLiteral ID="EncodedLiteral1" runat="server" Text="<%$Resources:wss,view_selector_view%>" EncodeMethod='HtmlEncode' />
                                            </td>
                                            <td nowrap="nowrap" class="ms-viewselector" id="onetViewSelector" onmouseover="this.className='ms-viewselectorhover'" onmouseout="this.className='ms-viewselector'" runat="server">
                                                <tlc:ViewSelector ID="viewSelector" MenuAlignment="Right" AlignToParent="false" runat="server" EnableViewState="true" />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="toolbarButton">
                        <asp:ImageButton runat="server" CausesValidation="false" ID="SwitchToThumbViewBtn"
                            CssClass="SwitchToThumbViewBtn" Text="<%$Resources:TemplateLibraryConnector,UI_SwitchToThumbnailView%>"
                            OnClick="SwitchToThumbViewBtn_OnClick" ImageUrl="~/_layouts/images/ApThbC.png" ToolTip="<%$Resources:TemplateLibraryConnector,UI_SwitchToThumbnailView%>"/>
                    </div>
                    <div class="toolbarButton">
                        <asp:ImageButton runat="server" CausesValidation="false" ID="SwitchToListViewBtn"
                            CssClass="SwitchToListViewBtn" Text="<%$Resources:TemplateLibraryConnector,UI_SwitchToListView%>"
                            OnClick="SwitchToListViewBtn_OnClick" ImageUrl="~/_layouts/images/ApViewItem.gif" ToolTip="<%$Resources:TemplateLibraryConnector,UI_SwitchToListView%>" />
                    </div>
                    <div class="toolbarButton">
                        <asp:UpdatePanel runat="server" ID="favoriteImage" UpdateMode="Always">
                            <ContentTemplate>
                                <asp:ImageButton ID="FavButton" AlternateText="Add to favorites" runat="server" PostBackUrl="" OnClick="AddRemoveFavoriteBtnClick" ToolTip="<%$Resources:TemplateLibraryConnector,UI_AddToFavorites%>" />
                                <asp:Label runat="server" ID="lblConfirmationMessage" ></asp:Label>  
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                </div>
                

                <div id="TemplateList"> 
                  <div id="Content">
                      <asp:UpdatePanel UpdateMode="Conditional" ID="templatePanel" EnableViewState="true" runat="server">
                        <ContentTemplate>
                            <asp:Panel runat="server" ID="pnlGridView">
                                <tlc:SPGridViewMultiSortFilter runat="Server" ID="spDetailView" CssClass=GridList"
                                    OnRowDataBound="DetailViewRowDataBound" OnSelectedIndexChanged="DetailViewSelectedIndexChanged"
                                    DataKeyNames="ID"
                                    AutoGenerateColumns="False" EnableViewState="true">
                                    <AlternatingRowStyle CssClass="GridListRowAlternating"/>
                                    <RowStyle CssClass="GridListRow" />
                                    <SelectedRowStyle CssClass="GridListSelected" />
                                    <HeaderStyle CssClass="GridListHeader" />
                                    <PagerStyle CssClass="GridListPager" />
                                </tlc:SPGridViewMultiSortFilter>
                                <div id="Pager">
                                <SharePoint:SPGridViewPager runat="server" ID="spGridViewPager" GridViewId="spDetailView" OnClickNext="SpGridViewPagerOnClickNext"  OnClickPrevious="SpGridViewPagerOnClickPrevious"  />
                                </div>
                            </asp:Panel>
                            <asp:Panel runat="server" ID="pnlThumbNail">
                                <asp:DataList CssClass="ThumbnailList"  AutoGenerateColumns="false" AutoGenerateSelectButton="false" EnableViewState="true"
                                    ID="spDataList" RepeatDirection="Horizontal" RepeatColumns="4" runat="Server" OnItemDataBound="DataListItemDataBound" 
                                    OnItemCommand="DataListItemCommand" DataKeyNames="ID">
                                    <ItemStyle CssClass="ThumbnailItem" HorizontalAlign="Center" VerticalAlign="Top" />
                                    <SelectedItemStyle CssClass="ThumbnailItemSelected" HorizontalAlign="Center" VerticalAlign="Top" />
                                </asp:DataList>
                                <asp:Literal ID="NoItemsSelectedLiteral" runat="server" Text="<%$Resources:TemplateLibraryConnector,UI_NoItemsSelected%>" Visible="false" />
                                 <div id="ThumbPager">
                                <asp:LinkButton ID="btnPrevious" runat="server" Text="" OnClick="PagerOnClickPrevious" >
                                    <img style="vertical-align: middle;" src="/_layouts/images/prev.gif" alt="" border="0"/>
                                </asp:LinkButton>
                                <asp:Literal ID="ltrCurrentItems" runat="server" Text="" />
                                <asp:LinkButton ID="btnNext" runat="server" Text="" OnClick="PagerOnClickNext" >
                                    <img style="vertical-align: middle;" src="/_layouts/images/next.gif" alt="" border="0"/>
                                </asp:LinkButton>
                            </div>
                            </asp:Panel>
                         </ContentTemplate>
                      </asp:UpdatePanel>
                    </div>

                </div>
            </div>
        </div>
     </div>
    <asp:Label ID="Message" runat="server" ForeColor="Red" Font-Bold="true"></asp:Label>
    </div> 
    </div>
    <%-- Don't fuck with these "unlcosed" divs, there's a bug in the updatepanel that omits or includes closing divs differently on IE and FF, --%>
    <%-- so there's an extra closing div after the datalist to remedy this --%>
</asp:Content>
